/**
 * 
 */
package cn.dgfy.MyBatisStudy.bean;

/**
 * @author Tearfalls
 *
 */
public enum Sex {
	FEMALE(0, "女"),
	MALE(1, "男");

	private int code;
	private String desc;
	
	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	private Sex(int code, String desc) {
		this.setCode(code);
		this.setDesc(desc);
	}
	
	public static Sex getSexByCode(int code) {
		if (code == 0) {
			return Sex.FEMALE;
		} else {
			return Sex.MALE;
		}
	}
}
